/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.com.cliente;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;

/**
 *
 * @author dloaiza
 */
public class AlexStarkEntryPoint implements EntryPoint {
    
    public AlexStarkEntryPoint() {
    }

    public void onModuleLoad() 
    {
        
        Services.getUsuarioServices().validarUsuarioActivo(new AsyncCallback<String>() {

            public void onFailure(Throwable caught) {
                iniciarSesion();
            }

            public void onSuccess(String result) {
                
                RootPanel.get().clear();
                if(result.equals("1")){
                    MasterPage master = new MasterPage(1);
                    RootPanel.get().add(master);
                }
                else if(result.equals("2")){
                    MasterPage master = new MasterPage(1);
                    RootPanel.get().add(master);
                }
                else{
                    iniciarSesion();
                }
            }
        });
    }
    
    private void iniciarSesion(){
        MasterPage master = new MasterPage(1);
        RootPanel.get().add(master);
    }
}
